#include "projectfile.h"

class ProjectFilePrivate{
	public:
		ProjectFilePrivate() {}
		~ProjectFilePrivate() {}
		QUrl sourceUrl;
};

ProjectFile::ProjectFile(ProjectItem *parent) :
	ProjectItem(parent), O_PRIVATE_CREATE(ProjectFile)
{
	O_D(ProjectFile);
	//d->
}

QUrl ProjectFile::source()
{
	O_D(ProjectFile);
	return d->sourceUrl;
}

void ProjectFile::setSource(const QUrl& url)
{
	O_D(ProjectFile);
	d->sourceUrl = url;
	setName(url.toString());
}

bool ProjectFile::create()
{
	O_D(ProjectFile);
	setSource(QUrl());
	setName(QString());
	return true;
}

ProjectFile::~ProjectFile()
{
	O_PRIVATE_DELETE;
}

QVariantMap ProjectFile::serialize()
{
	O_D(ProjectFile);
	QVariantMap map = ProjectItem::serialize();
	map.insert("source", source());
	return map;
}

void ProjectFile::deserialize( const QVariantMap& m )
{
	O_D(ProjectFile);
	setSource(QUrl(m.value("source").toUrl()));
}
